<%- include header.ejs%>


<div style="width: 65%;float: left;">
    <form>
        <select name="language" style="width:100px;margin-top: 45px;" onchange="submit(this);">
            <option value=""><%= __('active').lan%></option>
            <% plateDatas.forEach(function(plateData,index){%>
            <% if(language==plateData._id){%>
            <option value="<%- plateData._id%>" selected="selected"><%- plateData.platename%></option>
            <%}else{%>
            <option value="<%- plateData._id%>"><%- plateData.platename%></option>
            <%}%>
            <% })%>
        </select>
    </form>
    <% if(datas.length==0){%>
    <div style="height:200px;background-color: white;border: 1px solid #ffffff;-moz-border-radius: 10px;-webkit-border-radius: 10px;margin-top: 20px;padding: 20px;text-align: center">
        <div style="color: #000000;margin-top: 20px;font-size: large;line-height: 150px"><%= __('findPartner').hint %>!!!</div>
    </div>
    <%}else{%>
    <div class="circular" style="background-color: white;border: 1px solid #ffffff;margin-top: 20px;">
        <% datas.forEach(function(data,index){ %>
        <div style="padding: 2%;padding-bottom: 0px">
            <div style="width: 12%;float: left">
                <img class="img-rounded" src="<%-data.publishUser.headSrc%>" style="width: 50px;height: 50px;">
            </div>
            <div style="width: 70%;float: left">
                <span style=""><h4 style="margin: 0px"><b><a href="/postParticulars?id=<%- data._id %>" target="_blank"><%- data.theme %></a></b></h4></span><br>
                <span style="color:#c3c3c3 "><%=__('forumEntry').publisher%>：<a href="/partnerCenter?username=<%- data.publishUser.username %>"><%- data.publishUser.nickname%></a></span>
            </div>
            <div style="width: 70px;background-color: #f2f2f2;float: left;height: 40px;-moz-border-radius: 5px;-webkit-border-radius: 5px;padding: 1%">
                <span><%=__('forumEntry').scan%>：<%- data.hitTotal %></span><br>
                <span><%=__('forumEntry').reply%>：<%-data.replyTotal %></span>
            </div>
            <div style="clear: both"></div>
            <hr style="margin-bottom: 0px">
        </div>
        <% }) %>
    </div>
    <%}%>
</div>
<div style="width: 25%;float: left;margin-left: 3%;margin-top: 50px">
    <div style="text-align:center;border-radius: 10px;background-color: #d77a01;height: 60px;">
        <a href="/post" target="_blank" style="text-decoration: none"><h3 style="color: white;line-height: 60px"><%=__('forumEntry').publish%></h3></a>
    </div>
    <div style="margin-top: 30px;">
        <form id="search">
            <div class="input-append" style="width: 85%">
                <input type="text" placeholder="<%=__('forumEntry').search%>"  name="search" style="width: 100%" onfocus="showborder(this);" onblur="hiddenborder(this)"><img src="/images/search.png" style="width: 30px;height: 30px;" onclick="searchsubmit();">
            </div>
        </form>
    </div>
    <div class="circular" style="padding:1%;border: 1px solid #ffffff;height: 260px;background-color: white;margin-top: 20px">
        <h4><span style="font-size: larger"><%= __('active').regular%></span></h4>
        <% users.forEach(function(user,index){%>
        <div style="width: 20%;float: left;text-align: center;margin-left: 2%;margin-top: 10px">
            <img class="img-rounded" src="<%-user.headSrc%>" style="width: 55px;height: 55px">
            <span style="display: block"><a href="/partnerCenter?username=<%- user.username %>"><%- user.nickname %></a></span>
        </div>
        <%})%>
        <div style="clear: both"></div>
    </div>
    <div class="circular" style="padding: 3%;background-color: white;margin-top: 40px">
        <h3 style="margin-bottom: 50px"><span style="font-size: larger;color: #979797;"><%=__('forumEntry').hot%></span></h3>
        <% hotPosts.forEach(function(hotPost,index){%>
        <div style="float: left;width: 23%;text-align: center">
            <img class="img-rounded" src="<%- hotPost.publishUser.headSrc%>" style="width: 53px;height: 53px">
            <span style="display: block"><a href="/partnerCenter?username=<%- hotPost.publishUser.username %>"><%- hotPost.publishUser.nickname %></a></span>

        </div>
        <div style="float: left;width: 75%;margin-left: 2%">
            <span style="font-size: large;"><a href="/postParticulars?id=<%-hotPost._id%>" TARGET="_blank"><%-hotPost.theme%></a></span><br>
            <span style="font-size: small;color:#797979;float: right;margin-top: 12px;margin-right: 10%"><%-hotPost.postDate.format('yyyy-MM-dd hh:mm')%></span>
        </div>
        <div style="clear: both"></div>
        <hr style="border: 1px dotted #979797">
        <%})%>
    </div>
</div>
<div style="clear: both;margin-top: 20px"></div>
<div class="span12">
    <div id="page1"></div>
</div>

<%- include footer.ejs%>
<script>
    function searchsubmit(){
        $("#search").submit();
    }
    function showborder(obj){
        obj.style.cssText="border:1px #D79114 solid;width: 100%";
    }
    function hiddenborder(obj){
        obj.style.cssText="width: 100%";
    }
    function submit(obj){
        obj.submit();
    }
    function test(){
//        alert($(window).height())       //可见区域高度
//        alert($(window).width())        //可见区域宽度
//        alert($(document).height())     //整个页面高度
//        alert($(document).width())      //整个页面宽度
        alert($(document).scrollTop())  //获取滚动条到顶部的垂直高度
    }
    $(function(){
        //获得浏览器参数

        $.extend({
            getUrlVars: function(){
                var vars = [];
                var hash;
                var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
                console.log(hashes);
                for(var i = 0; i < hashes.length; i++){
                    hash = hashes[i].split('=');
                    vars.push(hash[0]);
                    vars[hash[0]] = hash[1];
                }
                return vars;
            },
            getUrlVar: function(name){
                return $.getUrlVars()[name];
            }
        });

        //封装浏览器参数
        var composeUrlParams=function(){
            var param='';
            $.each($.getUrlVars(), function(i, item) {
                if(item!='num'){
                    var val=$.getUrlVar(item);
                    if(val) param += "&" + item+"="+val;
                }
            });
            return param;
        }
        var options = {
            currentPage:<%- page.num %>,                //当前页，css样式同其他页不同
            totalPages:<%- page.pageCount %>,           //总页数
            numberOfPages:5,                            //导航最多显示页数
            pageUrl: function(type, page, current) {    //页面跳转
                if(page!=<%- page.num %>){
                    return "/forumEntry?num="+ page+composeUrlParams();
                }

            }
        }
        $('#page1').bootstrapPaginator(options);
    })
</script>